package com.netscenery.yang.model;

import java.util.ArrayList;




/**
 * 
 * @author llly
 *
 */
public class Container extends Node {
	private String presence;
	
	
	public Container(Env env, String nodeName) throws ModelException{
		super(env,nodeName);
	}
	
	public boolean isMandatory(){
		if (!isNullString(presence)){
			return false;
		}
		ArrayList<Node> schemaSons= getSchemaSons();
		if (null == schemaSons){
			return false;
		}
		
		int size = schemaSons.size();
		for(int i = 0; i < size; i++){
			Node son = schemaSons.get(i);
			if (null != son){
				if (son instanceof Node){
					if (son.isMandatory()){						
						return true;						
					}
				}			
			}
		}
		return false;
	}

	/**
	 * @return the presence
	 */
	public String getPresence() {
		return presence;
	}

	/**
	 * @param presence the presence to set
	 */
	public void setPresence(String presence) {
		this.presence = presence;
	}

	@Override
	public void update() {
		// TODO Auto-generated method stub
		
	}


}
